<template>
	<view class="container">
		<block v-if="isload">
			<dd-tab :itemdata="['订单信息','用户信息']" :itemst="['1','2']" :st="st" :isfixed="true"
				@changetab="changetab"></dd-tab>
			<view style="width:100%;height:100rpx"></view>
			<view class="container" id="datalist" v-if="st==1">
							<block v-for="(item, index) in datalist" :key="index">
								<view class="order-box">
									<view class="content" style="border-bottom:none">
										<view class="detailBox">
											<view class="detail">
												<text class="t1">{{item.allName}}</text>
												<view class="t2">创始人: {{item.realname}}</view>
												<view class="t2">电话: {{item.tel}}</view>
			
												<view class="detailList">
													<view class="detailItem">
														<view class="t2">微信昵称: {{item.nickname}}</view>
														<view class="t2">微信号码: {{item.weixin}}</view>
													</view>
													<view class="detailItem">
														<view class="t2">支付宝昵称: {{item.aliaccountname}}</view>
														<view class="t2">支付宝账号: {{item.aliaccount}}</view>
													</view>
												</view>
											</view>
											<view class="detailRight">
			
												<view class="price">￥{{item.product_price}}</view>
											</view>
										</view>
									</view>
									<view class="op">
										<view class="t2">订单编号: {{item.ordernum}}</view>
										<view class="show" v-if="item.status == 0" :style="'color:#FFAA33'">待审核</view>
										<view class="show" v-if="item.status == 1" :style="'color:#288aec'">审核成功</view>
										<view class="show" v-if="item.status == -1" :style="'color:#FF0000  '">审核失败</view>
									</view>
								</view>
							</block>
						</view>
						<view class="container" id="datalist" v-if="st==2">
										<block v-for="(item, index) in datalist" :key="index">
											<view class="order-box" @tap="goto" :data-url="'checkinfo?id='+item.id + '&allianceId=' + item.allianceId">
												<view class="content" style="border-bottom:none">
													<view class="detailBox">
														<view class="detail">
															<text class="t1">{{item.nickname}}</text>
															<view class="t2">姓名: {{item.realname}}</view>
															<view class="t2">电话: {{item.tel}}</view>
														</view>
													</view>
												</view>
											</view>
										</block>
									</view>
			<nomore v-if="nomore"></nomore>
			<nodata v-if="nodata"></nodata>
		</block>
		<loading v-if="loading"></loading>
	</view>
</template>

<script>
	var app = getApp();

	export default {
		data() {
			return {
				opt: {},
				loading: false,
				isload: false,
				menuindex: -1,
				st: 2,
				datalist: [],
				pagenum: 1,
				nomore: false,
				nodata: false,
				codtxt: "",
				keyword: "",
				// newitem: [{
				// 	"id": 59,
				// 	"ordernum": "240508105235134781",
				// 	"product_price": 100,
				// 	"nickname": "134****7143",
				// 	"realname": null,
				// 	"allName": "华尚",
				// 	"tel": "13402817143",
				// 	"weixin": null,
				// 	"aliaccount": null,
				// 	"aliaccountname": null,
				// 	"status": 0,
				// 	"allianceId": "28"
				// },
				// {
				// 	"id": 59,
				// 	"ordernum": "240508105235134781",
				// 	"product_price": 100,
				// 	"nickname": "134****7143",
				// 	"realname": null,
				// 	"allName": "华尚",
				// 	"tel": "13402817143",
				// 	"weixin": null,
				// 	"aliaccount": null,
				// 	"aliaccountname": null,
				// 	"status": 0,
				// 	"allianceId": "28"
				// }]
			};
		},

		onLoad: function(opt) {
			this.opt = app.getopts(opt);
			if (this.opt && this.opt.st) {
				this.st = this.opt.st;
			}
			this.getdata();
		},
		onPullDownRefresh: function() {
			this.getdata();
		},
		onReachBottom: function() {
			if (!this.nodata && !this.nomore) {
				this.pagenum = this.pagenum + 1;
				this.getdata(true);
			}
		},
		onNavigationBarSearchInputConfirmed: function(e) {
			this.searchConfirm({
				detail: {
					value: e.text
				}
			});
		},
		methods: {
			getdata: function(loadmore) {
				if (!loadmore) {
					this.pagenum = 1;
					this.datalist = [];
				}
				var that = this;
				var pagenum = that.pagenum;
				var st = that.st;
				that.nodata = false;
				that.nomore = false;
				that.loading = true;
				app.post('ApiAllianceCard/userInfo', {
					name: that.keyword,
					type: st,
					allianceId: this.opt.id,
					page: pagenum,
					limit: 10
				}, function(res) {
					console.log('res=====>', res)
					that.loading = false;
					var data = res.data.data;
					if (pagenum == 1) {
						that.datalist = data;
						if (data.length == 0) {
							that.nodata = true;
						}
						that.loaded();
					} else {
						if (data.length == 0) {
							that.nomore = true;
						} else {
							var datalist = that.datalist;
							var newdata = datalist.concat(data);
							that.datalist = newdata;
						}
					}
				});
			},
			changetab: function(st) {
				this.st = st;
				uni.pageScrollTo({
					scrollTop: 0,
					duration: 0
				});
				this.getdata();
			},
			searchConfirm: function(e) {
				this.keyword = e.detail.value;
				this.getdata(false);
			}
		}
	};
</script>
<style>
	.container {
		width: 100%;
	}

	.topsearch {
		width: 94%;
		margin: 10rpx 3%;
	}

	.topsearch .f1 {
		height: 60rpx;
		border-radius: 30rpx;
		border: 0;
		background-color: #fff;
		flex: 1
	}

	.topsearch .f1 .img {
		width: 24rpx;
		height: 24rpx;
		margin-left: 10px
	}

	.topsearch .f1 input {
		height: 100%;
		flex: 1;
		padding: 0 20rpx;
		font-size: 28rpx;
		color: #333;
	}

	.order-content {
		display: flex;
		flex-direction: column
	}

	.order-box {
		width: 94%;
		margin: 10rpx 3%;
		padding: 16rpx 3%;
		background: #fff;
		border-radius: 8px
	}

	.order-box .head {
		display: flex;
		width: 100%;
		border-bottom: 1px #f4f4f4 solid;
		height: 70rpx;
		line-height: 70rpx;
		overflow: hidden;
		color: #999;
	}

	.order-box .head .f1 {
		display: flex;
		align-items: center;
		color: #333
	}

	.order-box .head .f1 image {
		width: 34rpx;
		height: 34rpx;
		margin-right: 4px
	}

	.order-box .head .st0 {
		width: 140rpx;
		color: #ff8758;
		text-align: right;
	}

	.order-box .head .st1 {
		width: 140rpx;
		color: #ffc702;
		text-align: right;
	}

	.order-box .head .st2 {
		width: 140rpx;
		color: #ff4246;
		text-align: right;
	}

	.order-box .head .st3 {
		width: 140rpx;
		color: #999;
		text-align: right;
	}

	.order-box .head .st4 {
		width: 140rpx;
		color: #bbb;
		text-align: right;
	}

	.order-box .content {
		display: flex;
		width: 100%;
		padding: 16rpx 0px;
		border-bottom: 1px #f4f4f4 dashed;
		position: relative
	}

	.order-box .content:last-child {
		border-bottom: 0;
	}

	.order-box .content image {
		width: 140rpx;
		height: 140rpx;
	}

	.order-box .content .detail {
		display: flex;
		flex-direction: column;
		margin-left: 14rpx;
		flex: 1
	}

	.order-box .content .detail .t1 {
		font-size: 38rpx;
		line-height: 36rpx;
		margin-bottom: 10rpx;
		font-weight: 400;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
	}

	.order-box .content .detail .t2 {
		height: 46rpx;
		line-height: 46rpx;
		color: #999;
		overflow: hidden;
		font-size: 26rpx;
	}

	.order-box .content .detail .t3 {
		display: flex;
		height: 40rpx;
		line-height: 40rpx;
		color: #ff4246;
	}

	.order-box .content .detail .x1 {
		flex: 1
	}

	.order-box .content .detail .x2 {
		width: 100rpx;
		font-size: 32rpx;
		text-align: right;
		margin-right: 8rpx
	}

	.order-box .bottom {
		width: 100%;
		padding: 10rpx 0px;
		border-top: 1px #f4f4f4 solid;
		color: #555;
	}

	.order-box .op {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		padding: 10rpx 0 10rpx 25rpx;
		border-top: 1px #f4f4f4 solid;
		color: #555;
	}


	.detailBox {
		margin-left: 10rpx;
		flex: 1;
		display: flex;
		justify-content: space-between;
	}

	.detailBox .detailRight {
		font-size: 28rpx;
		font-weight: 400;
	}

	.detailBox .detailRight .price {
		font-size: 34rpx;
		color: #00FF00;
	}


	.detailList {
		/* margin-top: 10rpx; */
		flex: 1;
		display: flex;
		justify-content: space-between;
	}

	..detailList .detailItem {
		flex: 1;
		line-height: 40rpx;
	}
</style>